package cn.china.xfood.service;

import com.github.pagehelper.PageHelper;
import entity.Product;
import mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Properties;

@Service
public class ProductService implements ProductMapper {
    @Autowired
    ProductMapper productMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return productMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Product record) {
        return productMapper.insert(record);
    }

    @Override
    public int insertSelective(Product record) {
        return productMapper.insertSelective(record);
    }

    @Override
    public Product selectByPrimaryKey(Integer id) {
        return productMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<String> getProductType() {
        return productMapper.getProductType();
    }

    /**
     * 查询菜品
     *
     * @param type
     * @param pageNum
     * @param pageCount
     * @return
     */
    @Override
    public List<Product> getByType(String type, int pageNum, int pageCount) {
        return productMapper.getByType(type,pageNum,pageCount);
    }


    @Override
    public int getCountByType(String type) {
        return productMapper.getCountByType(type);
    }

    @Override
    public int updateByPrimaryKeySelective(Product record) {
        return productMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Product record) {
        return productMapper.updateByPrimaryKey(record);
    }



}
